package org.dromara.web.controller.app;


import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.dromara.common.core.domain.R;
import org.dromara.dao.business.domain.Model;
import org.dromara.dao.business.domain.ModelParam;
import org.dromara.dao.business.domain.ModelPrompt;
import org.dromara.web.service.business.ModelParamService;
import org.dromara.web.service.business.ModelPromptService;
import org.dromara.web.service.business.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 模型相关
 *
 */
@RestController
@RequestMapping("/app/model")
public class AppModelController {


    @Autowired
    ModelService modelService;
    @Autowired
    ModelParamService modelParamService;
    @Autowired
    ModelPromptService modelPromptService;


    /**
     *  模型列表
     *
     * @return
     */
    @SaIgnore
    @Operation
    @Parameter(name = "type", description = "模型分类  TEXT 文本聊天 模型   IMAGE： 文生图模型")
    @GetMapping("/list")
    public R<List<Model>>  getModels(String type) {

        return R.ok(modelService.getValidModelList(type));
    }


    /**
     *  获取文生图模型参数列表
     *
     * @param modelId
     * @return
     */
    @Operation
    @GetMapping("/model_param")
    public R<List<ModelParam>> getModelParams(Long modelId) {

        return R.ok(modelParamService.queryAll(modelId));
    }


    /**
     * 获取提示词
     *
     * @return
     */
    @Operation
    @GetMapping("/model_prompt")
    public R<List<ModelPrompt>> getModelPrompts() {

        return R.ok(modelPromptService.getPrompt());
    }
}
